add path argument to selection callbacks.
authorJonathan Blandford <jrb@redhat.com>
Fri, 29 Jun 2001 07:28:08 +0000 (07:28 +0000)
committerJonathan Blandford <jrb@src.gnome.org>
Fri, 29 Jun 2001 07:28:08 +0000 (07:28 +0000)
Fri Jun 29 03:14:16 2001  Jonathan Blandford  <jrb@redhat.com>

* gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
add path argument to selection callbacks.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktreeselection.c
gtk/gtktreeselection.h

index f557ba76fbebdd7443031dbf934c8af23064859d..e3d4b5482ff9a29a0311db1f634ca7d013ac3038 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jun 29 03:14:16 2001  Jonathan Blandford  <jrb@webwynk.net>
+
+       * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
+       add path argument to selection callbacks.
+
 Fri Jun 29 00:13:34 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to
index f557ba76fbebdd7443031dbf934c8af23064859d..e3d4b5482ff9a29a0311db1f634ca7d013ac3038 100644 (file)
@@ -1,3 +1,8 @@
+Fri Jun 29 03:14:16 2001  Jonathan Blandford  <jrb@webwynk.net>
+
+       * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
+       add path argument to selection callbacks.
+
 Fri Jun 29 00:13:34 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to
index f557ba76fbebdd7443031dbf934c8af23064859d..e3d4b5482ff9a29a0311db1f634ca7d013ac3038 100644 (file)
@@ -1,3 +1,8 @@
+Fri Jun 29 03:14:16 2001  Jonathan Blandford  <jrb@webwynk.net>
+
+       * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
+       add path argument to selection callbacks.
+
 Fri Jun 29 00:13:34 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to
index f557ba76fbebdd7443031dbf934c8af23064859d..e3d4b5482ff9a29a0311db1f634ca7d013ac3038 100644 (file)
@@ -1,3 +1,8 @@
+Fri Jun 29 03:14:16 2001  Jonathan Blandford  <jrb@webwynk.net>
+
+       * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
+       add path argument to selection callbacks.
+
 Fri Jun 29 00:13:34 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to
index f557ba76fbebdd7443031dbf934c8af23064859d..e3d4b5482ff9a29a0311db1f634ca7d013ac3038 100644 (file)
@@ -1,3 +1,8 @@
+Fri Jun 29 03:14:16 2001  Jonathan Blandford  <jrb@webwynk.net>
+
+       * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
+       add path argument to selection callbacks.
+
 Fri Jun 29 00:13:34 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to
index f557ba76fbebdd7443031dbf934c8af23064859d..e3d4b5482ff9a29a0311db1f634ca7d013ac3038 100644 (file)
@@ -1,3 +1,8 @@
+Fri Jun 29 03:14:16 2001  Jonathan Blandford  <jrb@webwynk.net>
+
+       * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
+       add path argument to selection callbacks.
+
 Fri Jun 29 00:13:34 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to
index f557ba76fbebdd7443031dbf934c8af23064859d..e3d4b5482ff9a29a0311db1f634ca7d013ac3038 100644 (file)
@@ -1,3 +1,8 @@
+Fri Jun 29 03:14:16 2001  Jonathan Blandford  <jrb@webwynk.net>
+
+       * gtk/gtktreeselection.c (gtk_tree_selection_selected_foreach):
+       add path argument to selection callbacks.
+
 Fri Jun 29 00:13:34 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to
index 8c35a71ec1e574004eaac8dd6c409d999b2fd02b..c03ba7ee6cb631eac36b59f66f9e3483f861c547 100644 (file)
@@ -386,14 +386,19 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection            *selection,
 
   if (selection->type == GTK_TREE_SELECTION_SINGLE)
     {
-      if (gtk_tree_selection_get_selected (selection, NULL, &iter))
-       (* func) (selection->tree_view->priv->model, &iter, data);
+      if (gtk_tree_row_reference_valid (selection->tree_view->priv->anchor))
+       {
+         path = gtk_tree_row_reference_get_path (selection->tree_view->priv->anchor);
+         gtk_tree_model_get_iter (selection->tree_view->priv->model, &iter, path);
+         (* func) (selection->tree_view->priv->model, path, &iter, data);
+         gtk_tree_path_free (path);
+       }
       return;
     }
 
   tree = selection->tree_view->priv->tree;
   node = selection->tree_view->priv->tree->root;
-
+  
   while (node->left != tree->nil)
     node = node->left;
 
@@ -401,12 +406,11 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection            *selection,
   path = gtk_tree_path_new_root ();
   gtk_tree_model_get_iter (selection->tree_view->priv->model,
                           &iter, path);
-  gtk_tree_path_free (path);
 
   do
     {
       if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
-       (* func) (selection->tree_view->priv->model, &iter, data);
+       (* func) (selection->tree_view->priv->model, path, &iter, data);
       if (node->children)
        {
          gboolean has_child;
@@ -418,7 +422,7 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection            *selection,
            node = node->left;
          tmp = iter;
          has_child = gtk_tree_model_iter_children (selection->tree_view->priv->model, &iter, &tmp);
-
+         gtk_tree_path_append_index (path, 0);
          /* Sanity Check! */
          TREE_VIEW_INTERNAL_ASSERT_VOID (has_child);
        }
@@ -434,6 +438,7 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection            *selection,
 
                  has_next = gtk_tree_model_iter_next (selection->tree_view->priv->model, &iter);
                  done = TRUE;
+                 gtk_tree_path_next (path);
 
                  /* Sanity Check! */
                  TREE_VIEW_INTERNAL_ASSERT_VOID (has_next);
@@ -446,11 +451,14 @@ gtk_tree_selection_selected_foreach (GtkTreeSelection            *selection,
                  node = tree->parent_node;
                  tree = tree->parent_tree;
                  if (tree == NULL)
-                   /* we've run out of tree */
-                   /* We're done with this function */
-                   return;
+                   {
+                     gtk_tree_path_free (path);
+                     /* we've run out of tree */
+                     /* We're done with this function */
+                     return;
+                   }
                  has_parent = gtk_tree_model_iter_parent (selection->tree_view->priv->model, &iter, &tmp_iter);
-
+                 gtk_tree_path_up (path);
                  /* Sanity check */
                  TREE_VIEW_INTERNAL_ASSERT_VOID (has_parent);
                }
@@ -877,7 +885,7 @@ gtk_tree_selection_select_range (GtkTreeSelection *selection,
   g_return_if_fail (selection->tree_view != NULL);
 
   if (gtk_tree_selection_real_select_range (selection, start_path, end_path))
-    gtk_signal_emit (G_OBJECT (selection), tree_selection_signals[CHANGED], 0);
+    g_signal_emit (G_OBJECT (selection), tree_selection_signals[CHANGED], 0);
 }
 
 /* Called internally by gtktreeview.c It handles actually selecting the tree.
index 0d9351677f182729ded93c559b033d38a2eeb86e..82c2c3bb7b31bcc2d093a65c2c3a186e0d7a7c0d 100644 (file)
@@ -45,6 +45,7 @@ typedef gboolean (* GtkTreeSelectionFunc)    (GtkTreeSelection  *selection,
                                              GtkTreePath       *path,
                                              gpointer           data);
 typedef void (* GtkTreeSelectionForeachFunc) (GtkTreeModel      *model,
+                                             GtkTreePath       *path,
                                              GtkTreeIter       *iter,
                                              gpointer           data);